//
// Created by Administrator on 2019/10/26.
//

#include "MediaInfo.h"

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}

void MediaInfoMain::getMediaInfo() {
    LOGD(_mediaPath);
    AVFormatContext *avFormatContext = NULL;
    char errors[1024];
    av_register_all();
    int errorCode = 0;


    errorCode = avformat_open_input(&avFormatContext, _mediaPath, NULL, NULL);
    if (errorCode < 0) {
        av_strerror(errorCode, errors, 1024);
        LOGD(errors);
        return;
    }
    av_dump_format(avFormatContext, 0, _mediaPath, 0);
    LOGD(_mediaPath);
    avformat_close_input(&avFormatContext);

}
